package com.itheima.mapper;

import com.itheima.pojo.Brand;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface BrandMapper {
    /**
     *查询所有
     * @return
     */
    @Select("select * from tb_brand")
    @ResultMap("brandResultMap")
    List<Brand> selectAll();

    /**
     * 根据id查询
     */
    @Select("select * from tb_brand where id=#{id}")
    Brand selectById(int id);

    /**
     * 添加品牌
     */
    @Insert("insert into tb_brand values (null,#{brandName},#{companyName},#{ordered},#{description},#{status})")
    @ResultMap("brandResultMap")
    void add(Brand brand);

    /**
     * 修改数据
     */
    @Update("update tb_brand set brand_name=#{barndName},company_name=#{companyName},ordered=#{ordered},description=#{description},status=#{status} where id=#{id}")
    @ResultMap("brandResultMap")
    void update(Brand brand);

    /**
     * 删除数据
     */
    @Delete("delete from tb_brand where id=#{id}")
    void deleteById(int id);

     void deleteByIds(@Param("ids") int[] ids);
}
